// pages/eventDetail/eventDetail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    event:[],
    imgsrcid:'',
    handlerPhoto:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var imgsrcid='http://139.9.169.87:9002/app/Event/getPhoto?id='+options.id+"&width=100&height=100"
    var handlerPhoto='http://139.9.169.87:9002/app/Event/getHandlerPhoto?id='+options.id+"&width=100&height=100"
    this.setData({
      imgsrcid,
      handlerPhoto
    })
    this.getEventDetail(options.id)
  },
  closure(e){
    console.log(e.currentTarget.dataset.id)
    wx.request({
      url: 'http://139.9.169.87:9002/app/Event/confirmation?id='+e.currentTarget.dataset.id,
      success:({data:res})=>{
        if(res.status==200){
          wx.showModal({
            content:'确认结案！',
            showCancel:false,
            success:()=>{
              wx.redirectTo({
                url: '/pages/event/event',
              })
            }
          })
        }
      }
    })
  },
  getEventDetail(id){
    wx.request({
      url: 'http://139.9.169.87:9002/app/Event/getEventById?id='+id,
      success:({data:res})=>{
        this.setData({
          event:res.data
        })
      }
    })
  },
})